package org.su.webadapter.validate;

import org.su.generalmvc.validate.Validater;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * Created by yangchuan on 15/12/22.
 */
public class PatternValidator implements IValidator {
    @Override
    public String validate(Object values,Object object){
        Pattern pattern = (Pattern)object;
        return  (values == null || (Validater.validateMatch(pattern.regexp(),values.toString()))) ?  null : pattern.message();
    }
}
